import datamodel
from google.appengine.ext import db

def getSearchfors(user):
  query = db.Query(datamodel.Searchfors)
  query.filter('user =', user)
  results = query.get()
  return results
  
def setSearchfors(user, age_from = '', age_to = '', gender = ''):
  searchfor = datamodel.Searchfors()
  searchfor.user = user
  if age_from:
    searchfor.age_from = int(age_from)
  if age_to:
    searchfor.age_to = int(age_to)
  if gender:
    searchfor.gender = str(gender)
  searchfor.put()
  return searchfor